﻿/*
 * @Autor: PK
 * @Date: 2022/01/11 11:41:SS
 */

using System.Collections.Generic;
using System.Linq;
using Itinero.Profiles;
using ShkSimulation.carsharing;
using Vehicle = Itinero.Osm.Vehicles.Vehicle;

namespace ShkSimulation.carsharing.impl.model {

	public class NavigateProfileProvider {

		private static Dictionary<NavigateType, Profile> ProfileInstances =
			new Dictionary<NavigateType, Profile>() {
				{ NavigateType.Fastest, Vehicle.Car.Fastest() },
				{ NavigateType.Shortest, Vehicle.Car.Shortest() },
				{ NavigateType.Adaptive, Vehicle.Bus.Fastest() }
			};

		public static List<Itinero.Profiles.Vehicle> Profiles => new List<Itinero.Profiles.Vehicle>(ProfileInstances.Values.Select(each => each.Parent));

		public static IProfileInstance GetProfileByNavigateType(NavigateType navigateType) {
			return ProfileInstances[navigateType];
		}
		
		public static void RegisterProfile(NavigateType navigateType, Profile profileInstance) {
			ProfileInstances[navigateType] = profileInstance;
		}

	}

}